
#include "bridge.h"

const char*	PortTimers_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortTimers_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortTimers_802_1w_2001_InitState		(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortInformation_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortInformation_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortInformation_802_1w_2001_InitState		(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortRoleSelection_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortRoleSelection_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortRoleSelection_802_1w_2001_InitState			(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortRoleTransitions_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortRoleTransitions_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortRoleTransitions_802_1w_2001_InitState		(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortStateTransition_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortStateTransition_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortStateTransition_802_1w_2001_InitState		(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	TopologyChange_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	TopologyChange_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		TopologyChange_802_1w_2001_InitState		(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortProtocolMigration_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortProtocolMigration_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortProtocolMigration_802_1w_2001_InitState			(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	PortTransmit_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	PortTransmit_802_1w_2001_CheckConditions	(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		PortTransmit_802_1w_2001_InitState			(BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

const char*	BridgeDetection_802_1w_2001_GetStateName (SM_STATE state);
SM_STATE	BridgeDetection_802_1w_2001_CheckConditions (BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);
void		BridgeDetection_802_1w_2001_InitState       (BRIDGE* bridge, int givenPort, int givenTree, SM_STATE state);

static const SM_INFO smInfo [] =
{
	{
		SM_INFO::PER_PORT,
		"PortTimers",
		PortTimers_802_1w_2001_GetStateName,
		PortTimers_802_1w_2001_CheckConditions,
		PortTimers_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_PORT_PER_TREE,
		"PortInformation",
		PortInformation_802_1w_2001_GetStateName,
		PortInformation_802_1w_2001_CheckConditions,
		PortInformation_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_BRIDGE_PER_TREE,
		"PortRoleSelection",
		PortRoleSelection_802_1w_2001_GetStateName,
		PortRoleSelection_802_1w_2001_CheckConditions,
		PortRoleSelection_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_PORT_PER_TREE,
		"PortRoleTransitions",
		PortRoleTransitions_802_1w_2001_GetStateName,
		PortRoleTransitions_802_1w_2001_CheckConditions,
		PortRoleTransitions_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_PORT_PER_TREE,
		"PortStateTransition",
		PortStateTransition_802_1w_2001_GetStateName,
		PortStateTransition_802_1w_2001_CheckConditions,
		PortStateTransition_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_PORT_PER_TREE,
		"TopologyChange",
		TopologyChange_802_1w_2001_GetStateName,
		TopologyChange_802_1w_2001_CheckConditions,
		TopologyChange_802_1w_2001_InitState
	},
	
	{
		SM_INFO::PER_PORT,
		"PortProtocolMigration",
		PortProtocolMigration_802_1w_2001_GetStateName,
		PortProtocolMigration_802_1w_2001_CheckConditions,
		PortProtocolMigration_802_1w_2001_InitState
	},

	{
		SM_INFO::PER_PORT,
		"BridgeDetection",
		BridgeDetection_802_1w_2001_GetStateName,
		BridgeDetection_802_1w_2001_CheckConditions,
		BridgeDetection_802_1w_2001_InitState,
	},
		
};

static const SM_INFO transmitSmInfo =
{	
	SM_INFO::PER_PORT_PER_TREE, // in 802.1Q this is PER_PORT, but the 1w state machine looks at the port role
	"PortTransmit",
	PortTransmit_802_1w_2001_GetStateName,
	PortTransmit_802_1w_2001_CheckConditions,
	PortTransmit_802_1w_2001_InitState
};

const SM_INTERFACE smInterface_802_1w_2001 =
{
	smInfo,
	sizeof (smInfo) / sizeof (SM_INFO),
	&transmitSmInfo
};



